<include file="./top" />

<!-- start: Header -->
<include file="./head" />
<!-- end: Header -->

<div class="container-fluid content">
<div class="row"> 
  <!-- start: Main Menu --> 
  <include file="./slide" /> 
  <!-- end: Main Menu --> 
  
  <!-- start: Content -->
  <div class="main sidebar-minified"> 
    <!--div class="row">
      <div class="col-lg-12">
        <h3 class="page-header"><i class="fa fa-table"></i>{$title}</h3>
      </div>
    </div-->
    <div class="row">
      <div class="col-lg-12">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h2><i class="fa fa-table red"></i><span class="break"></span><strong>{$title}</strong></h2>
            <div class="panel-actions"> <a href="table.html#" class="btn-setting"><i class="fa fa-rotate-right"></i></a> <a href="table.html#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a> </div>
          </div>
          <div class="panel-body">
            <form action="{:U('Jifei/lanjie_log')}" method="get" class="form-inline">
              <div class="form-group">
                <select class="btn"  name="select" id="select">
                  <option value="0">请选择查询类型</option>
                  <option value ="uid" <?php if(I('get.select')=='uid'){ ?>selected <?php }?>>会员ID</option>
                </select>
              </div>
              <div class="form-group">
                <input name="nr" id="nr" type="text" class="form-control" value="{:I('get.nr')}" />
              </div>
              <div class="form-group"> <span class="btn btn-primary ">按时间查询：</span></div>
              <div class="form-group">
                <input name="act_start_time" id="act_start_time" type="text" class="form-control" value="{:I('get.act_start_time')}" placeholder="开始时间≥当前时间" title="开始时间≥当前时间" readonly="readonly" style="cursor:pointer;"/>
              </div>
              <div class="form-group"> -> </div>
              <div class="form-group">
                <input name="act_stop_time" id="act_stop_time" type="text" class="form-control" value="{:I('get.act_stop_time')}" placeholder="结束时间>开始时间" title="结束时间>开始时间" readonly="readonly" style="cursor:pointer;"/>
              </div>
              <div class="form-group">
                <button type="submit" class="btn btn-primary btn-success" id="but"><i class="fa fa-dot-circle-o"></i> 查询日志</button>
                <button type="button" class="btn btn-primary btn-danger"  id="del"><i class="fa fa-ban"></i> 删除日志</button>
                <?php if($where){?>
                <a href="<?php echo U('Jifei/lanjie_log');?>" class="btn btn-primary">清楚所有条件</a>
                <?php } ?>
              </div>
            </form>
          </div>
          <div class="panel-body">
            <table class="table table-striped table-bordered bootstrap-datatable datatable">
              <thead>
                <tr>
                  <th width="4%">ID</th>
                  <th width="5%">会员ID</th>
                  <th width="8%">IP</th>
                  <th width="10%">时间</th>
                  <th width="10%">手机品牌</th>
                  <th width="14%">浏览器</th>
                  <th width="10%">操作系统</th>
                  <th width="20%">拦截原因</th>
                  <th width="20%">useragent</th>
                </tr>
              </thead>
              <tbody>
                <?php foreach($log as $v): ?>
                <tr>
                  <td>{$v['id']}</td>
                  <td>{$v['uid']}</td>
                  <td>{:long2ip($v['ip'])}</td>
                  <td>{:date("Y-m-d H:i:s",$v['time'])}</td>
                  <td><img src="__PUBLIC__{:str_img($v['platform'])}"> {$v['platform']}</td>
                  <td><img src="__PUBLIC__{:str_img($v['browser'])}"> {$v['browser']}</td>
                  <td><img src="__PUBLIC__{:str_img($v['os'])}"> {$v['os']}</td>
                  <td>{$v['info']}</td>
                  <td><a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="ui-elements.html#con{$v['id']}"> 点击查看详细 </a>
                    <div id="con{$v['id']}" class="panel-collapse collapse"> {$v['useragent']} </div></td>
                </tr>
                <?php endforeach;?>
              </tbody>
            </table>
          </div>
                  <div class="panel-body">
      <ul class="pagination">
        {$page}
      </ul>
         </div>
        </div>
      </div>
      <!--/col-->

    </div>
  </div>
</div>
<include file="./foot" />
<style type="text/css">
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 45%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 45% 10px 10px; }
</style>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/jq_time/jquery-ui.css" />
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery-ui-1.10.4.custom.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery.ui.datepicker-zh-CN.js"></script> 
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery-ui-timepicker-zh-CN.js"></script> 
<script type="text/javascript">
$(function(){
    $( "input[name='act_start_time'],input[name='act_stop_time']" ).datetimepicker();
    $("#but").click(function(){
            var act_start_time= $("#act_start_time").val();
		    var act_stop_time= $("#act_stop_time").val();
			var selects = $("#select").val();
			var nr = $("#nr").val();
			if(selects==0 && nr==''){
			   	if(!act_start_time && !act_stop_time){ 
			     yz_alert(0,"查询时间或者查询值必须写一个!");
				 return false;
			    }
			}	
		 });
    //删除
	$("#del").click(function(){
			var act_start_time= $("#act_start_time").val();
			var act_stop_time= $("#act_stop_time").val();
			var selects = $("#select").val();
			var nr = $("#nr").val();
			var info = '确认删除';
		    if(selects==0 && nr==''){
			   	if(!act_start_time && !act_stop_time){ 
			     yz_alert(0,"删除日志时间或者查询值必须写一个!");
				 return false;
			    }
			}else{ 
			 info = info+selects+"等于"+nr+"  ";
			}
		    if(act_start_time && act_stop_time){ 
			  info = info + act_start_time+"到"+act_stop_time;
			 }
			info = info +"的拦截日志吗???";
			if (confirm(info)==true){   
                $.ajax({
					 type:'GET',
					 url:'{:U("Jifei/del_lanjie_log")}',
					 data:{"act_start_time":act_start_time,"act_stop_time":act_stop_time,"selects":selects,'nr':nr},
					 dataType:"json",
					 success: function(data){
						var data = eval(data);
						yz_alert(data.status,data.info);
				     }
				  })   
             }
		});
});
</script>
</body>
</html>
